package com.spark;

import org.ansj.app.summary.SummaryComputer;
import org.ansj.app.summary.pojo.Summary;
import org.ansj.splitWord.analysis.ToAnalysis;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by TRS on 2017/6/22.
 */
public class ToId {

    public static void main(String[] args) throws IOException {
        File file=new File("E:\\file\\svm 数据");
        File [] files=file.listFiles();
        List<String> lists=new ArrayList<String>();
        Integer id=0;
        for (File f:files){
            List<String> lines=FileUtils.readLines(f);
            for(String line:lines){


                line=line.substring(1,line.length()-1).trim();
                String title = "";

                SummaryComputer summaryComputer = new SummaryComputer(20, title, line);


                Summary summary = summaryComputer.toSummary();



                lists.add(f.getName().substring(0,1)+"===="+id+"===="+summary.getSummary()+"===="+line);
                id++;
                System.out.println(id);

                if(id>1000){
                    break;
                }
            }

        }
        File file1=new File("E:\\file\\svm 数据\\all.txt");
        FileUtils.writeLines(file1,"UTF-8",lists);


    }
}
